import { useEffect, useRef, useState } from 'react';
export default (initialvalue) => {
  const [value, updateValue] = useState(initialvalue);
  const ref = useRef(value);
  useEffect(() => {
    ref.current = value;
  }, [value]);
  return [value, updateValue, ref];
};
